package com.zyark.web.controller;

import com.zyark.domain.MemberInfo;
import com.zyark.service.MemberInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by ron on 17-9-2.
 */

@Controller
@RequestMapping("api/v1/anon")
public class ClientMembersController {

    @Resource
    MemberInfoService memberInfoService;

    @RequestMapping(value = "members",method = RequestMethod.GET)
    @ResponseBody
    public Object getMembers(@RequestParam(value = "type")Integer type,@RequestParam(value = "pageSize",required = false)Integer pageSize,@RequestParam(value = "pageNumber",required = false)Integer pageNumber){
        if (type == 0){
            if (pageNumber == null){
                pageNumber = 1;
            }
            if (pageSize == null){
                pageSize = 3;
            }
            return memberInfoService.selectPage(pageNumber,pageSize);
        }else {
            return memberInfoService.selectPage(null,null);
        }
    }

}
